from typing import Dict, List
import os

SYSTEM_METRICES_SCRIPTS = [
    "system_metrices_tuned动态优化.sh",
    "system_文件描述符耗尽.sh"
]

def select_script_for_anomaly(anomaly: Dict) -> str:
    root_cause = anomaly.get("root_cause", "").lower()
    evidence = " ".join(anomaly.get("evidence", [])).lower()
    if "tuned" in root_cause or "tuned" in evidence:
        return "system_metrices_tuned动态优化.sh"
    if "文件描述符" in root_cause or "fd" in root_cause or "描述符耗尽" in root_cause:
        return "system_文件描述符耗尽.sh"
    return SYSTEM_METRICES_SCRIPTS[0] 